<template>
<!-- 闪屏页 -->
  <div class="splash" v-show="autoPlay">
       <img :src="imgSrc">
       <span class="jump" @click="jump()">点击跳转</span>
  </div>
</template>

<script>

export default {
    data(){
        return {
            adBack:false,
            index:5,
            imgSrc:require('./img/1.jpg'),
            timer:null
        }
    },
    methods:{
        // 定时器
        autoPlay(){
           this.timer = setInterval(this.play,1000)
        },
        play(){
            this.index--;
            if(this.index == 0){
                this.jump()
            }
        },
        jump(){
            this.adBack = !this.adBack
            clearInterval(this.timer)
        }
    }, 
    mounted(){
        this.autoPlay()
    },
    // 轮播图
    // destroyed(){
    //     clearInterval(this.timer)
    // }

}
</script>

<style>

</style>